<?php


namespace app\model;

use core\lib\Model;

class GoodsModel extends Model
{
    public $table = 'mall_goods';

    public function lists() {
        return $this->getAll();
    }

    public function getCount() {
        $sql = "select COUNT(*) as count from {$this->table}";
        $ret = $this->pdo->query($sql);
        $ret->setFetchMode(\PDO::FETCH_ASSOC);
        return $ret->fetch();
    }

    public function getByIds($id) {
        $sql = "select * from {$this->table} where id={$id}";
        $ret = $this->pdo->query($sql);
        $ret->setFetchMode(\PDO::FETCH_ASSOC);
        return $ret->fetch();
    }
}